package com.coollang.smartbra.presenter;

import com.coollang.smartbra.activity.ActionDetailActivity;
import com.coollang.smartbra.beans.ActionDetailItem;
import com.coollang.smartbra.constant.Constants;
import com.coollang.smartbra.interfaces.ActionType;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: Timmy
 * @data: 2017/11/22
 * @Fuction: 数据库详情页面数据
 */
public class ActionDetailActivityPresenter {

    private ActionDetailActivity mDetailActivity;

    public ActionDetailActivityPresenter(ActionDetailActivity detailActivity) {
        mDetailActivity = detailActivity;
    }


    /**
     * 加载左边数据
     */
    public void loadLeftData(int currentPostion) {
        List<ActionDetailItem> items = new ArrayList<>();
        ActionDetailItem detailItem = new ActionDetailItem(ActionDetailItem.DETAILED_DESCRIPTION_HEAD);
        detailItem.setText(Constants.DetailedDescription.heart1);
        items.add(detailItem);

        String[] detailedDescriptionContent = {};

        switch (Constants.ACTION_NAME_ID1[currentPostion]) {
            case ActionType.SDT:
                detailedDescriptionContent = Constants.SDT_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.YWQZ:
                detailedDescriptionContent = Constants.YWQZ_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.JF:
                detailedDescriptionContent = Constants.JF_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.FWC:
                detailedDescriptionContent = Constants.FWC_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.PBZC:
                detailedDescriptionContent = Constants.PBZC_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.TQ:
                detailedDescriptionContent = Constants.TQ_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.ZQ:
                detailedDescriptionContent = Constants.ZQ_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.LTQ:
                detailedDescriptionContent = Constants.LTQ_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.XFY:
                detailedDescriptionContent = Constants.XFY_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.ZZST:
                detailedDescriptionContent = Constants.ZZST_DETAILED_DESCRIPTION_CONTENT;
                break;
            case ActionType.JFZYMJ:
                detailedDescriptionContent = Constants.JFZYMJ_DETAILED_DESCRIPTION_CONTENT;
                break;
            default:
                detailedDescriptionContent = Constants.PBZC_DETAILED_DESCRIPTION_CONTENT;
                break;
        }

        for (String s : detailedDescriptionContent) {
            ActionDetailItem detailItem1 = new ActionDetailItem(ActionDetailItem.DETAILED_DESCRIPTION_CONTENT);
            detailItem1.setText(s);
            items.add(detailItem1);
        }

        ActionDetailItem detailItem2 = new ActionDetailItem(ActionDetailItem.DETAILED_DESCRIPTION_HEAD);
        detailItem2.setText(Constants.DetailedDescription.heart2);
        items.add(detailItem2);

        String[] detailedDescriptionHuxi = {};

        switch (Constants.ACTION_NAME_ID1[currentPostion]) {
            case ActionType.SDT:
                detailedDescriptionHuxi = Constants.SDT_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.YWQZ:
                detailedDescriptionHuxi = Constants.YWQZ_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.JF:
                detailedDescriptionHuxi = Constants.JF_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.FWC:
                detailedDescriptionHuxi = Constants.FWC_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.PBZC:
                detailedDescriptionHuxi = Constants.PBZC_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.TQ:
                detailedDescriptionHuxi = Constants.TQ_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.ZQ:
                detailedDescriptionHuxi = Constants.ZQ_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.LTQ:
                detailedDescriptionHuxi = Constants.LTQ_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.XFY:
                detailedDescriptionHuxi = Constants.XFY_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.ZZST:
                detailedDescriptionHuxi = Constants.ZZST_DETAILED_DESCRIPTION_HUXI;
                break;
            case ActionType.JFZYMJ:
                detailedDescriptionHuxi = Constants.JFZYMJ_DETAILED_DESCRIPTION_HUXI;
                break;
            default:
                detailedDescriptionHuxi = Constants.PBZC_DETAILED_DESCRIPTION_HUXI;
                break;
        }

        for (String s : detailedDescriptionHuxi) {
            ActionDetailItem detailItem1 = new ActionDetailItem(ActionDetailItem.DETAILED_DESCRIPTION_CONTENT);
            detailItem1.setText(s);
            items.add(detailItem1);
        }

        mDetailActivity.mDetailAdapter.setNewData(items);
    }

    /**
     * 加载右边数据
     */
    public void loadRightData(int currentPostion) {
        List<ActionDetailItem> items = new ArrayList<>();

        String[] detailedDescriptionContent = {};

        switch (Constants.ACTION_NAME_ID1[currentPostion]) {
            case ActionType.SDT:
                detailedDescriptionContent = Constants.SDT_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.YWQZ:
                detailedDescriptionContent = Constants.YWQZ_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.JF:
                detailedDescriptionContent = Constants.JF_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.FWC:
                detailedDescriptionContent = Constants.FWC_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.PBZC:
                detailedDescriptionContent = Constants.PBZC_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.TQ:
                detailedDescriptionContent = Constants.TQ_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.ZQ:
                detailedDescriptionContent = Constants.ZQ_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.LTQ:
                detailedDescriptionContent = Constants.LTQ_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.XFY:
                detailedDescriptionContent = Constants.XFY_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.ZZST:
                detailedDescriptionContent = Constants.ZZST_DETAILED_DESCRIPTION_ERROR;
                break;
            case ActionType.JFZYMJ:
                detailedDescriptionContent = Constants.JFZYMJ_DETAILED_DESCRIPTION_ERROR;
                break;
            default:
                detailedDescriptionContent = Constants.PBZC_DETAILED_DESCRIPTION_ERROR;
                break;
        }
        for (String s : detailedDescriptionContent) {
            ActionDetailItem detailItem1 = new ActionDetailItem(ActionDetailItem.COMMON_MISTAKES);
            detailItem1.setText(s);
            items.add(detailItem1);
        }

        mDetailActivity.mDetailAdapter.setNewData(items);
    }
}
